<?php
/* [$WindsForce] (C)Hunzhiwange.COM Since 2012.03.17.
   查看装修大片($$)*/

!defined('Q_PATH') && exit;

class Show_C_Controller extends InitController{

	public function index(){
		$nId=intval(Q::G('id','G'));
		if(empty($nId)){
			$this->page404();
		}

		$arrJiajucase=Model::F_('jiajucase','@A','A.jiajucase_id=? AND A.jiajucase_status=1',$nId)
			->setColumns('A.jiajucase_id,A.jiajucase_title,A.create_dateline,A.jiajucase_viewnum,A.jiajucase_commentnum,A.jiajucase_pics,A.jiajucase_picnum')
			->join(Q::C('DB_PREFIX').'jiajucasecontent AS E','E.jiajucase_content','A.jiajucase_id=E.jiajucase_id')
			->join(Q::C('DB_PREFIX').'jiajucompany AS F','F.jiajucompany_isfvip,F.jiajucompany_id,F.jiajucompany_domain,F.jiajucompany_shortname,,F.jiajucompany_fullname,F.jiajucompany_logo','A.jiajucompany_id=F.jiajucompany_id')
			->join(Q::C('DB_PREFIX').'site AS H','H.site_domain,H.site_name','A.site_id=H.site_id')
			->getOne();

		if(empty($arrJiajucase['jiajucase_id'])){
			$this->page404();
		}

		// 更新点击量
		Model::M_('jiajucase')->updateWhere(array('jiajucase_viewnum'=>$arrJiajucase['jiajucase_viewnum']+1),'jiajucase_id=?',$nId);
		$arrJiajucase['jiajucase_viewnum']++;

		Core_Extend::getSeo($this,array(
			'title'=>$arrJiajucase['jiajucase_title'].'装修照片_'.$arrJiajucase['jiajucase_title'].'装修图片_'.$arrJiajucase['jiajucase_title'].'装修素材',
			'keywords'=>$arrJiajucase['jiajucase_title'].'装修照片,'.$arrJiajucase['jiajucase_title'].'装修图片,'.$arrJiajucase['jiajucase_title'].'装修素材',
			'description'=>$GLOBALS['_option_']['site_name'].'为你精心提供'.$arrJiajucase['jiajucase_title'].'装修照片，'.$arrJiajucase['jiajucase_title'].'装修图片，'.$arrJiajucase['jiajucase_title'].'装修素材，为你的装修大业插上飞翔的翅膀。'),true,false);

		if($arrJiajucase['jiajucase_pics']){
			$arrCasepics=json_decode($arrJiajucase['jiajucase_pics'],true);
		}else{
			$arrCasepics=array();
		}
		
		$this->assign('arrJiajucase',$arrJiajucase);
		$this->assign('arrCasepics',$arrCasepics);
		$this->display('photo+show');
	}

}
